#include <iostream>
#include <algorithm>
#include<vector>
using namespace std;

// 已知
int n, m;
vector<int> b(222222,-(1<<30)), w(222222,0);
// 未知
long long sum = 0;

int main()
{
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> b[i];
    for (int i = 0; i < m; i++)
    {
        cin >> w[i];
        if(w[i]<0) w[i]=0;
    }
    n=max(n,m);
    sort(b.begin(), b.begin()+n,[](int a, int b){return a > b;});
    sort(w.begin(), w.begin()+n,[](int a, int b){return a > b;});
    for (int i = 0; i < n and b[i]+w[i]>0; ++i) sum+=b[i]+w[i];
    cout << sum;
    return 0;
}